/**
 * Copyright  (c) 2009-2013 XLab,  Org. 
 * All  rights  reserved. 
 */
package org.xlab.baseframework.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.xlab.baseframework.domain.enumerate.EnumLogLevel;
import org.xlab.baseframework.system.Declare;

/**
 * 系统日志实体类
 * 
 * @author MaKuBEX Email:makubexnet@gmail.com
 * @version 1.0.0 Sep 6, 2010
 * @since 1.0.0
 * 
 */
@Entity
@Table(name = "T_SYS_LOG")
public class SystemLog extends AbstractNormalVersionControlDomainObject {

	/**
	 * @serialField
	 */
	private static final long serialVersionUID = 3312506393948651098L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = Declare.DEFAULT_SYSTEM_DB_SEQUENCE)
	@SequenceGenerator(name = Declare.DEFAULT_SYSTEM_DB_SEQUENCE, sequenceName = Declare.DEFAULT_SYSTEM_DB_SEQUENCE, allocationSize = 1, initialValue = 0)
	@Column(name = "ID_")
	private Long id;
	@Column(name = "CREATED_BY_NAME", length = 200)
	private String createdByName;
	@Column(name = "LASTUPDATED_BY_NAME", length = 200)
	private String lastUpdatedByName;
	@Column(name = "TITLE_", length = 255)
	private String title;
	@Lob
	@Column(name = "CONTENT_")
	private String content;
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = SystemCode.class)
	@JoinColumn(name = "LOG_TYPE", referencedColumnName = "CODE_", nullable = false)
	private SystemCode logType;
	@Enumerated(value = EnumType.ORDINAL)
	@Column(name = "LOG_LEVEL", nullable = false, length = 20)
	private EnumLogLevel logLevel;

	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @return the createdByName
	 */
	public String getCreatedByName() {
		return createdByName;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @return the lastUpdatedByName
	 */
	public String getLastUpdatedByName() {
		return lastUpdatedByName;
	}

	/**
	 * @return the logLevel
	 */
	public EnumLogLevel getLogLevel() {
		return logLevel;
	}

	/**
	 * @return the logType
	 */
	public SystemCode getLogType() {
		return logType;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param content
	 *            the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * @param createdByName
	 *            the createdByName to set
	 */
	public void setCreatedByName(String createdByName) {
		this.createdByName = createdByName;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @param lastUpdatedByName
	 *            the lastUpdatedByName to set
	 */
	public void setLastUpdatedByName(String lastUpdatedByName) {
		this.lastUpdatedByName = lastUpdatedByName;
	}

	/**
	 * @param logLevel
	 *            the logLevel to set
	 */
	public void setLogLevel(EnumLogLevel logLevel) {
		this.logLevel = logLevel;
	}

	/**
	 * @param logType
	 *            the logType to set
	 */
	public void setLogType(SystemCode logType) {
		this.logType = logType;
	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "SystemLog [id=" + id + ", createdByName=" + createdByName
				+ ", lastUpdatedByName=" + lastUpdatedByName + ", title="
				+ title + ", content=" + content + ", logType=" + logType
				+ ", logLevel=" + logLevel + "]";
	}
}
